import 'dart:ui';

import 'package:flutter/material.dart';

class HomePage extends StatefulWidget {
  HomePage({Key key}) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      //增加布局与状态栏的距离，不然布局会直接顶到状态栏中
      appBar: PreferredSize(
        preferredSize:
            Size.fromHeight(MediaQueryData.fromWindow(window).padding.top),
        child: SafeArea(
          top: true,
          child: Offstage(),
        ),
      ),
      body: Container(
        child: Column(
          children: [
            RaisedButton(
              child: Text("页面跳转及传值"),
              onPressed: () {
                Navigator.pushNamed(context, '/SubmitPage',
                    arguments: {'name': '小米十一', 'pice': '3999'});
              },
            )
          ],
        ),
      ),
    );
  }
}
